package maa.action.factory;

import maa.action.Action;
import maa.action.admin.ShowLog;
import maa.action.admin.course.*;
import maa.action.admin.group.ViewGroups;
import maa.action.admin.group.ViewGroupsDash;
import maa.action.admin.mentor.*;
import maa.action.admin.user.*;
import maa.action.all.*;
import maa.action.anonym.Register;
import maa.action.client.EditProfile;
import maa.action.client.MySubscriptions;
import maa.action.client.SubscribeForCourse;
import maa.action.client.UnsubscribeFromCourse;
import maa.action.mentor.MyCourses;

import java.util.HashMap;

public class ActionFactory {
    HashMap<String,Action> actionMap = new HashMap<String, Action>();
    public ActionFactory() {
        actionMap = new HashMap<>();
        actionMap.put("GET/registration-form", new ViewAction("registration"));
        actionMap.put("POST/login", new Login());
        actionMap.put("POST/logout", new Logout());
        actionMap.put("POST/register", new Register());
        actionMap.put("GET/login-form", new ViewAction("login"));
        actionMap.put("GET/account", new ViewAction("account"));
        actionMap.put("GET/main", new ViewAction("main"));
        actionMap.put("GET/courses", new ViewCourses());
        actionMap.put("GET/mentors", new ViewMentorList());
        actionMap.put("GET/success", new ViewAction("success"));
        actionMap.put("index", new ViewAction("main"));
        actionMap.put("GET/course-creation", new CourseCreationPage());
        actionMap.put("POST/create-course", new AddCourse());
        actionMap.put("GET/admin-cabinet", new ViewAction("admin-cabinet"));
        actionMap.put("GET/user-creation", new ViewAction("user-creation"));
        actionMap.put("POST/create-user", new AddUser());
        actionMap.put("GET/successful-registration", new ViewAction("successful-registration"));
        actionMap.put("GET/view-courses", new ViewCoursesAd());
        actionMap.put("GET/view-users", new ViewUsers());
        actionMap.put("GET/hide-courses", new HideCourses());
        actionMap.put("GET/hide-users", new HideUsers());
        actionMap.put("POST/remove-course", new RemoveCourse());
        actionMap.put("POST/remove-user", new RemoveUser());
        actionMap.put("POST/user-update-page", new UserUpdatePage());
        actionMap.put("POST/course-update-page", new CourseUpdatePage());
        actionMap.put("GET/user-update", new ViewAction("user-update"));
        actionMap.put("POST/update-user", new UpdateUser());
        actionMap.put("POST/edit-profile", new EditProfile());
        actionMap.put("POST/update-course", new UpdateCourse());
        actionMap.put("GET/course-update", new ViewAction("course-update"));
        actionMap.put("POST/mentor-creation-page", new MentorCreationPage());
        actionMap.put("GET/mentor-creation", new ViewAction("mentor-creation"));
        actionMap.put("POST/create-mentor", new AddMentor());
        actionMap.put("GET/view-mentors", new ViewMentors());
        actionMap.put("GET/hide-mentors", new HideMentors());
        actionMap.put("POST/mentor-update-page", new MentorUpdatePage());
        actionMap.put("POST/mentor-update", new UpdateMentor());
        actionMap.put("GET/mentor-update", new ViewAction("mentor-update"));
        actionMap.put("POST/remove-mentor", new RemoveMentor());
        actionMap.put("POST/choose-mentor", new ChooseMentor());
        actionMap.put("GET/choose-mentor", new ViewAction("choose-mentor"));
        actionMap.put("POST/appoint-mentor", new AppointMentor());
        actionMap.put("POST/subscribe", new SubscribeForCourse());
        actionMap.put("POST/unsubscribe", new UnsubscribeFromCourse());
        actionMap.put("GET/my-subscriptions", new MySubscriptions());
        actionMap.put("GET/user-self-update", new ViewAction("user-self-update"));
        actionMap.put("GET/index", new ViewAction("index"));
        actionMap.put("POST/change-locale", new ChangeLocale());
        actionMap.put("GET/view-groups-dash", new ViewGroupsDash());
        actionMap.put("GET/groups", new ViewGroups());
        actionMap.put("GET/my-courses", new MyCourses());
        actionMap.put("POST/restore-mentor", new RestoreMentor());
        actionMap.put("GET/show-log", new ShowLog());
    }
    public Action getAction(String actionName){
        Action action = actionMap.get(actionName);
        return action;
    }
}
